<?php

namespace app\api\controller;

use think\Config;
use app\common\controller\Api;
use think\Db;

/**
 * 首页接口
 */
class Index extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    /**
     * 首页
     *
     */
    public function index()
    {
        $this->success('请求成功');
    }

    /**
     * 获取地区
     *
     */
    public function area()
    {
        $pid = $_REQUEST['pid']??0;
        $area = Db::name("area")
            ->where("pid",$pid)
            ->field("id,name")
            ->select();

        $this->success('请求成功',$area);
    }

    /**
     * 获取配置
     *
     */
    public function setting()
    {
        $type = $_REQUEST['type']??'购物流程';
        $area = Db::name("setting")
            ->where("type",$type)
            ->field("title,content")
            ->select();
        $this->success('请求成功',$area);
    }
    /**
     * 获取微信客服列表
     *
     */
    public function getWxQrCode()
    {
        $list = Db::name("qrcode")->order("sort asc")->select();
        if ($list){
            $this->success('请求成功',$list);
        }else{
            $this->success('暂无数据',$list);
        }

    }
}
